home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 May: Tool Chest / Developer CD Series Tool Chest (Apple Computer)(May 1999).iso / Tool Chest / Devices / NuBus⁄Slot Manager / Declaration ROMs / Ex Apple Video ROM / PrimaryInit.a < prev   
Encoding:
Text File  |  1992-08-14  |  4.5 KB  |  130 lines  |  [TEXT/MPS ]

  1.  
  2. ;*********************************************************************
  3. ;*********************************************************************
  4. ;
  5. ;    File           : PrimaryInit.a
  6. ;    Description    : This file contains the Primary Init code for the Apple
  7. ;                    video board, with information that is specific to
  8. ;                    the Apple video stubbed out (since locations and
  9. ;                    functions of the Apple video board may change, 
  10. ;                    and the information is propriatary).
  11. ;
  12. ;*********************************************************************
  13. ;*********************************************************************
  14.  
  15. ;=====================================================================
  16. ;    Header
  17. ;=====================================================================
  18.                 DC.B    sExec_2                        ;Code revision (Primary init)
  19.                 DC.B    sCPU_68020                    ;CPU type is 68020
  20.                 DC.W    0                            ;Reserved
  21.                 DC.L    Begin-*                        ;Offset to code.
  22.  
  23.  
  24. ;=====================================================================
  25. ;PROCEDURE PrimaryInit(Slot:sInteger_8; VAR VendorStatus,Status:sInteger_16);
  26. ;=====================================================================
  27. ;BEGIN {Primary Init}
  28.                 WITH     seBlock
  29.  
  30. ;  Set initial vendor status and save vars.
  31. Begin            MOVE.W    #1,seStatus(A0)                ;VendorStatus <- 1 {Code was executed}
  32.                 MOVE.L    A0,A3                        ;save param block {A0 is destroyed}
  33.  
  34.  
  35. ;  Turn the slot number into a base address.
  36.                 MOVEQ    #0,D0                        ;D0 <- 00000000
  37.                 MOVE.B    seSlot(A0),D0                ;D0 <- 0000000s
  38.                 LSL.W    #4,D0                        ;D0 <- 000000s0
  39.                 OR.B    seSlot(A0),D0                ;D0 <- 000000ss
  40.                 OR.W    #$F00,D0                    ;D0 <- 00000Fss
  41.                 SWAP    D0                            ;D0 <- 0Fss0000
  42.                 LSL.L    #4,D0                        ;D0 <- Fss00000
  43.                 MOVE.L    D0,A2                        ;A2 <- Base address to the slot.
  44.  
  45.  
  46. ;  Reset the hardware.
  47. ;  DO YOUR RESET STUFF HERE
  48.  
  49. ;  Set mode to one bit per pixel.                    ;
  50. ;  DO YOUR MODE SETTING HERE                
  51.                 
  52. ;  Disable interrupts.                                ;
  53.                 MOVE.L    A2,A0                        ;get slot base
  54.                 ADD.L    #DisableVInt,A0                ;Adjust the base
  55.                 CLR.B    (A0)                        ;Disable interrupt from card
  56.  
  57.  
  58. ; set the color table to black and white
  59. ; SET THE TABLE HERE
  60.  
  61.  
  62. ; The Apple Video card configuration ROM has two video sResources conforming to the
  63. ; two possible different memory configurations.  Now we want to figure out which
  64. ; of the configurations we have, and delete the incorrect video sResource from
  65. ; the slot resource table.
  66. ;
  67. ;  size the RAM on the video card.  To do this, we look for a nice longword in the second
  68. ;    half of the frame buffer array that doesn't show up on the screen.  I've selected the
  69. ;    last longword of the first scanline that is a multiple of 8 in the second RAM bank (line 264).  
  70. ;    This alignment guarantees that this memory is off the right edge in all pixel depths
  71. ;    when the frame buffer base addr is on a normal page boundary.
  72. ;
  73. ;
  74. ;
  75. TestPos            EQU        (265*1024)-4                ;    
  76. TestPat            EQU        'MAC2'                        ;test bit pattern
  77.                 WITH    spBlock                        ;use the template
  78.                 
  79.                 SUBA    #spBlockSize,SP                ;make an SDM parameter block on stack
  80.                 MOVE.L    SP,A0                        ;get pointer to parm block now
  81.                 MOVE.B    seSlot(A3),spSlot(A0)        ;put slot in pBlock
  82.                 CLR.B    spExtDev(A0)                ;external device = 0
  83.                 
  84.                 MOVE.L    #TestPos,D1                    ;get offset in D1
  85.                 MOVE.L    #TestPat,(A2,D1.L)            ;write to alleged RAM
  86.                 MOVE.L    #-1,-(SP)                    ;write out some garbage to clear data lines
  87.                 ADDQ    #4,SP                        ;and pitch it
  88.                 MOVE.L    (A2,D1.L),D0                ;read pattern back
  89.                 CMP.L    #TestPat,D0                    ;did it stick?
  90.                 BEQ.S    @1                            ;if equal, we have ram
  91.                 MOVE.B    #sRsrc_Video8,spID(A0)        ;if not, remove 8-bit table
  92.                 BRA.S    @2
  93. @1
  94.                 MOVE.B    #sRsrc_Video4,spID(A0)        ;remove 4-bit table if we have ram
  95. @2
  96.                 _sDeleteSRTRec                        ;remove the invalid entry
  97.                 BNE.S    @3                            ;
  98.                 MOVE    #2,seStatus(A3)                ;mark the change
  99. @3                ADDA    #spBlockSize,SP                ;clean up
  100.                 
  101.  
  102. ;  Clear video RAM to a nice gray
  103.                 MOVE.L    #$AAAAAAAA,D0                ;graypat1 := $AAAAAAAA
  104.                 MOVE.L    D0,D1
  105.                 NOT.L    D1
  106.  
  107.                 MOVE.W    #defScrnRow,D4                ;sRow := defScrnRow        {Bytes per pixel line}
  108.                 MOVE.W    #$200*4-1,D3                ;sHei := defScrnHeight    {Screen Height in pixels}
  109.                 
  110.                 MOVE.L    A2,A1                        ;init row pointer                                                                     ;REPEAT
  111. NxtRow            MOVE.L    A1,A0                        ;get next row
  112.                 MOVE.W    #defScrnRow/4-1,D2            ;  rowlongs := defScrnRow/4 - 1 {How many Longs there are}
  113. NxtLong            MOVE.L    D0,(A0)+                    ;    (A0) := graypat(1/2)
  114.                 DBF        D2,NxtLong                    ;  UNTIL rowlongs < 0
  115.                 EXG        D0,D1                        ;  graypat1 <-> graypat2
  116.                 ADD.W    D4,A1                        ;  A2 := A2 + sRow
  117.                 DBF        D3,NxtRow                    ;UNTIL sHei < 0
  118.  
  119. ;  Exit
  120. Exit             RTS                                    ;Return
  121.  
  122.         ENDWITH
  123.  
  124. ;<PUT YOUR VALUES FOR INIT TABLE, OTHER TABLES, ETC. HERE IF NEEDED>
  125.  
  126. ;END PrimaryInit
  127.  
  128.  
  129.  
  130.